package stdlib

import (
	. "lambda"
)

var ENV Environment = stdEnv{}

type stdEnv struct {
	funcs map[uint64](func([]Primitive) Primitive)
	preds map[uint64](func([]Primitive) bool)
}

func (env stdEnv) CallFunction(code uint64, args []Primitive) Primitive {
	return env.funcs[code](args)
}

func (env stdEnv) CallPredicate(code uint64, args []Primitive) bool {
	return env.preds[code](args)
}
